columnviewcolumn: Add reordering helpers
authorMatthias Clasen <mclasen@redhat.com>
Fri, 20 Dec 2019 22:19:55 +0000 (17:19 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 3 Jun 2020 17:31:39 +0000 (13:31 -0400)
Add helper functions that let us temporarily give
a different allocation to headers. These will be
used to implement interactive column reordering
in GtkColumnView.

gtk/gtkcolumnviewcolumn.c
gtk/gtkcolumnviewcolumnprivate.h

index 6a092096484b06c67edba0b0b9f7477e6715cb7b..8879457a7f208b49bf0f8ac248300d9817dcdef6 100644 (file)
@@ -60,6 +60,7 @@ struct _GtkColumnViewColumn
   int natural_size_request;
   int allocation_offset;
   int allocation_size;
+  int header_position;
 
   int fixed_width;
 
@@ -478,6 +479,7 @@ gtk_column_view_column_allocate (GtkColumnViewColumn *self,
 {
   self->allocation_offset = offset;
   self->allocation_size = size;
+  self->header_position = offset;
 }
 
 void
@@ -947,3 +949,22 @@ gtk_column_view_column_get_header (GtkColumnViewColumn *self)
 {
   return self->header;
 }
+
+void
+gtk_column_view_column_set_header_position (GtkColumnViewColumn *self,
+                                            int                  offset)
+{
+  self->header_position = offset;
+}
+
+void
+gtk_column_view_column_get_header_allocation (GtkColumnViewColumn *self,
+                                              int                 *offset,
+                                              int                 *size)
+{
+  if (offset)
+    *offset = self->header_position;
+
+  if (size)
+    *size = self->allocation_size;
+}
index 925343f998c2eed29d4067f359e0d9223dbac1af..2fa9afa98953f4c117e8f45619d438715f896155 100644 (file)
@@ -48,4 +48,10 @@ void                    gtk_column_view_column_get_allocation           (GtkColu
 
 void                    gtk_column_view_column_notify_sort              (GtkColumnViewColumn    *self);
 
+void                    gtk_column_view_column_set_header_position      (GtkColumnViewColumn    *self,
+                                                                         int                     offset);
+void                    gtk_column_view_column_get_header_allocation    (GtkColumnViewColumn    *self,
+                                                                         int                    *offset,
+                                                                         int                    *size);
+
 #endif  /* __GTK_COLUMN_VIEW_COLUMN_PRIVATE_H__ */